home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Champak 66
/
Vol 66.iso
/
games
/
doodle_d.swf
/
scripts
/
frame_4
/
DoAction_8.as
< prev
next >
Wrap
Text File
|
2013-04-24
|
6KB
|
154 lines
function laserFire()
{
laserTimer++;
if(laserTimer == laserSpeed)
{
switch(laserType)
{
case "standard":
depth = _root.lasers.getNextHighestDepth();
_root.lasers.attachMovie("laser","laser" + depth,depth);
curLas = eval("_root.lasers.laser" + depth);
curLas._x = ship._x;
curLas._y = ship._y;
curLas.dir = dir;
laserTimer = 0;
curLas._rotation = curLas.dir;
curLas.degrees = curLas.dir;
curLas.degrees -= 90;
curLas.radians = degrees * rad;
curLas.thrustDX = (speed / 2 + laserThrust) * cos(curLas.radians);
curLas.thrustDY = (speed / 2 + laserThrust) * sin(curLas.radians);
curLas.dx = curLas.thrustDX;
curLas.dy = curLas.thrustDY;
curLas._x += curLas.dx * 2;
curLas._y += curLas.dy * 2;
break;
case "burst":
depth = _root.lasers.getNextHighestDepth();
_root.lasers.attachMovie("laser","laser" + depth,depth);
curLas = eval("_root.lasers.laser" + depth);
curLas._x = ship._x;
curLas._y = ship._y;
curLas.dir = dir;
laserTimer = 0;
curLas._rotation = curLas.dir;
curLas.degrees = curLas.dir;
curLas.degrees -= 90;
curLas.radians = curLas.degrees * rad;
curLas.thrustDX = (speed / 2 + laserThrust) * cos(curLas.radians);
curLas.thrustDY = (speed / 2 + laserThrust) * sin(curLas.radians);
curLas.dx = curLas.thrustDX;
curLas.dy = curLas.thrustDY;
curLas._x += curLas.dx * 2;
curLas._y += curLas.dy * 2;
depth = _root.lasers.getNextHighestDepth();
_root.lasers.attachMovie("laser","laser" + depth,depth);
curLas = eval("_root.lasers.laser" + depth);
curLas._x = ship._x;
curLas._y = ship._y;
curLas.dir = dir + 7;
laserTimer = 0;
curLas._rotation = curLas.dir;
curLas.degrees = curLas.dir;
curLas.degrees -= 90;
curLas.radians = curLas.degrees * rad;
curLas.thrustDX = (speed / 2 + laserThrust) * cos(curLas.radians);
curLas.thrustDY = (speed / 2 + laserThrust) * sin(curLas.radians);
curLas.dx = curLas.thrustDX;
curLas.dy = curLas.thrustDY;
curLas._x += curLas.dx * 2;
curLas._y += curLas.dy * 2;
depth = _root.lasers.getNextHighestDepth();
_root.lasers.attachMovie("laser","laser" + depth,depth);
curLas = eval("_root.lasers.laser" + depth);
curLas._x = ship._x;
curLas._y = ship._y;
curLas.dir = dir - 7;
laserTimer = 0;
curLas._rotation = curLas.dir;
curLas.degrees = curLas.dir;
curLas.degrees -= 90;
curLas.radians = curLas.degrees * rad;
curLas.thrustDX = (speed / 2 + laserThrust) * cos(curLas.radians);
curLas.thrustDY = (speed / 2 + laserThrust) * sin(curLas.radians);
curLas.dx = curLas.thrustDX;
curLas.dy = curLas.thrustDY;
curLas._x += curLas.dx * 2;
curLas._y += curLas.dy * 2;
}
if(rightLaser)
{
rightDegrees = ship._rotation - 45;
rightRadians = rightDegrees * rad;
depth = _root.lasers.getNextHighestDepth();
_root.lasers.attachMovie("laser","laser" + depth,depth);
curLas = eval("_root.lasers.laser" + depth);
rPx = 15 * cos(rightRadians);
rPy = 10 * sin(rightRadians);
curLas._x = ship._x + rPx;
curLas._y = ship._y + rPy;
curLas.dir = dir;
laserTimer = 0;
curLas._rotation = curLas.dir;
curLas.degrees = curLas.dir;
curLas.degrees -= 90;
curLas.radians = curLas.degrees * rad;
curLas.thrustDX = (speed / 2 + laserThrust) * cos(curLas.radians);
curLas.thrustDY = (speed / 2 + laserThrust) * sin(curLas.radians);
curLas.dx = curLas.thrustDX;
curLas.dy = curLas.thrustDY;
curLas._x += curLas.dx * 2;
curLas._y += curLas.dy * 2;
}
if(leftLaser)
{
leftDegrees = ship._rotation - 135;
leftRadians = leftDegrees * rad;
depth = _root.lasers.getNextHighestDepth();
_root.lasers.attachMovie("laser","laser" + depth,depth);
curLas = eval("_root.lasers.laser" + depth);
lPx = 15 * cos(leftRadians);
lPy = 10 * sin(leftRadians);
curLas._x = ship._x + lPx;
curLas._y = ship._y + lPy;
curLas.dir = dir;
laserTimer = 0;
curLas._rotation = curLas.dir;
curLas.degrees = curLas.dir;
curLas.degrees -= 90;
curLas.radians = curLas.degrees * rad;
curLas.thrustDX = (speed / 2 + laserThrust) * cos(curLas.radians);
curLas.thrustDY = (speed / 2 + laserThrust) * sin(curLas.radians);
curLas.dx = curLas.thrustDX;
curLas.dy = curLas.thrustDY;
curLas._x += curLas.dx * 2;
curLas._y += curLas.dy * 2;
}
if(backLaser)
{
backDegrees = ship._rotation + 90;
backRadians = backDegrees * rad;
depth = _root.lasers.getNextHighestDepth();
_root.lasers.attachMovie("laser","laser" + depth,depth);
curLas = eval("_root.lasers.laser" + depth);
bPx = 15 * cos(backRadians);
bPy = 10 * sin(backRadians);
curLas._x = ship._x + bPx;
curLas._y = ship._y + bPy;
curLas.dir = dir + 180;
laserTimer = 0;
curLas._rotation = curLas.dir;
curLas.degrees = curLas.dir;
curLas.degrees -= 90;
curLas.radians = curLas.degrees * rad;
curLas.thrustDX = (speed / 2 + laserThrust) * cos(curLas.radians);
curLas.thrustDY = (speed / 2 + laserThrust) * sin(curLas.radians);
curLas.dx = curLas.thrustDX;
curLas.dy = curLas.thrustDY;
curLas._x += curLas.dx * 2;
curLas._y += curLas.dy * 2;
}
}
}